//
// Created by Shin on 2024/3/11.
//

#ifndef ANO_LX_FC_DRV_UPPERCOMPUTER_H
#define ANO_LX_FC_DRV_UPPERCOMPUTER_H
#include "main.h"
//#include "SysConfig.h"
//
//
#define BROADCAST_TYPE              0xFF
#define POS_TYPE                    0X32
#define ODOM_TYPE                   0X35
#define WP_TYPE                     0xF2
#define BARRIER_TYPE                0xF1
#define UP_CMD_TYPE                 0xF0
#define QR_TYPE                     0xF3
#define IMU_TYPE                    0x01

#define CMD_RESET_MAP_SERVER        0x01
#define CMD_HEARTBEAT               0xEE
//
///*
// * waypoint:s32-x,s32-y,u16-angle(-180~+180)
// * */
//
//
//
typedef struct {
    uint16_t err_cnt;
    uint16_t rec_cnt;
    uint8_t  cmd;
    uint8_t  is_alive;
}_upper_cmd_st;

//上位机数据
typedef struct {
    uint8_t  upper_pos_update_cnt;
    int upper_pos_x;
    int upper_pos_y;
    int upper_pos_z;
    int upper_pos_linear_acc_x;
    int upper_pos_linear_acc_y;
    int upper_pos_linear_acc_z;
    uint16_t upper_linear_vel_x;
    uint16_t upper_linear_vel_y;
    float yaw;
    uint8_t  upper_QR_msg;
}_upper_position_st;

union uint8_2_s32{
    uint8_t _u8_temp[4];
    int     _s32_temp;
};

union uint8_2_u16{
    uint8_t _u8_temp[2];
    uint16_t    _u16_temp;
};

union uint8_2_float{
    uint8_t _u8_temp[4];
    float   _float_temp;
};
extern _upper_cmd_st up_cmd;
extern _upper_position_st up_pos;

//void UpComputer_GetOneByte(uint8_t data);
void UpperComputer_DataAnl(uint8_t *data);
//u8 UpComputer_state(void);
//
//void UpperComputer_send_data(char *stream, ...);
//void Mix_Send_Data_2Up(u8 frame_num);
//void Reset_map_server(void);
//void Turn_BEEP_AND_LIGHT(int sta);
//int Get_Ahead_Cam_QR(u8 *qr_code);

#endif //ANO_LX_FC_DRV_UPPERCOMPUTER_H
